Only whack "extension" from pathname, not dirname, in bushnell. (testo
authorrobertl <robertl>
Sat, 13 Mar 2010 17:57:34 +0000 (17:57 +0000)
committerrobertl <robertl>
Sat, 13 Mar 2010 17:57:34 +0000 (17:57 +0000)
uses dots in directory names...)

bushnell.c

index 5bcdea8213dcbeafa50f8ff0b8eca12efb967dbc..de55ac18d30f43a9399156adc152988ff080cda7 100644 (file)
@@ -157,13 +157,14 @@ rd_deinit(void) {
 
 static void
 wr_init(const char *fname) {
-  char *dot;
+  char *dot, *slash;
 
   ofname = xstrdup(fname);
 
-  // If user provided an extension, whack it.
-  dot = strchr(ofname, '.');
-  if (dot) *dot = 0;
+  // If user provided an extension in the pathname, whack it.
+  dot = strrchr(ofname, '.');
+  slash = strrchr(ofname, GB_PATHSEP);
+  if (dot > slash) *dot = 0;
 
   static char valid_chars [] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789"
                ".-/\\~@#$%^&*()_+=<>"